<template>
	<view class="content">

		<view class="item item1">
			
			<view class="name">
				金额
			</view>

			<view class="time">
				时间
			</view>

		</view>
		<view v-if="list1.length">
			<view class="item" v-for="item in list1">
			
				<view class="name">
					+ {{ item.amt || '' }}
					<image class="money" src="../../static/images/money.png" mode=""></image>
				</view>

				<view class="time">
					{{ item.createTime }}
				</view>

			</view>
			<uni-load-more :status="status"></uni-load-more>
		</view>

		<view v-else class="empty">
				<image v-if="!list1.length && senDate" src="../../static/images/home/7.png" mode=""></image>
				<view v-if="!list1.length && senDate" class="nodata">
					暂无数据
				</view>
			<!-- <u-empty v-if="!list1.length && senDate" text="暂无数据" mode="list"></u-empty> -->
		</view>
	</view>
</template>

<script>

export default {
	data() {
		return {
			total: null, //总共多少条数据
			list1: [],
			formData: {
				pageSize: 20, //每页10条数据
				page: 1, //第几页
				topic: "",
			},
			status: "more",
			senDate: false,

		}
	},

	onReachBottom() {
		let allTotal = this.formData.page * this.formData.pageSize;
		if (allTotal < this.total) {
			//当前条数小于总条数 则增加请求页数
			this.status = "loading"; //加载中状态
			this.formData.page++;

			this.getList();

		} else {
			this.status = "noMore"; //加载完状态
			console.log("已加载全部数据");
		}
	},


	onLoad() {
		this.getList();
	},

	methods: {


		getList() {
			this.senDate = false;
			this.$u.api
				.fetchRebate({

				
					pageNum: this.formData.page,
					pageSize: this.formData.pageSize,
				})
				.then((res) => {

					this.senDate = true;
					if (res.code == 200) {

						console.log(res.data,666666);
						this.total = res.data.total;
						const newlist = res.data.rows;
						this.list1.push(...newlist);
						if (this.list1.length < this.formData.pageSize) {
							this.status = "noMore"; //加载完状态
						}
						
						// this.list1=[{
						// 	createTime:'2023-10-14 10:12:10',
						// 	amt:8.8
						// },{
						// 	createTime:'2023-10-14 10:12:10',
						// 	amt:8.8
						// },{
						// 	createTime:'2023-10-14 10:12:10',
						// 	amt:8.8
						// },{
						// 	createTime:'2023-10-14 10:12:10',
						// 	amt:8.8
						// }]
					} else {
						console.log("请求数据失败");
					}



				});





		},

		// getList() {
		// 	this.searDate = false;

		// 	// 判断当前是否在请求，如果为true正在请求数据，就让他返回空，如果为false没在请求，就让它开始请求数据
		// 	if (this.load) {
		// 		return;
		// 	}
		// 	this.load = true;
		// 	// 请求数据时，状态改为加载中状态
		// 	this.status = "loading";

		// 	this.$u.api
		// 		.subordinate()
		// 		.then((res) => {

		// 			this.list = res.data;

		// 		});
		// },


	}


}
</script>
<style>

</style>
<style scoped lang="scss">
.photo {
	width: 30px;
	height: 30px;
	display: block;
	width: 76rpx;
	height: 76rpx;
	border-radius: 50%;
}

.tit {
	font-size: 13px;
	font-family: PingFang SC-Medium, PingFang SC;
	font-weight: 500;
	color: #ED2933;
	line-height: 15px;
	padding-bottom: 10px;
}

.empty {
	padding: 100px 0;
}

.content {
	margin: 0 15px;
	border-radius: 8px;
	overflow: hidden;

	.item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		font-size: 13px;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		
		line-height: 19px;
		background: #F4F2F2;
		// border-bottom: 1px solid #382d0d;
		// height: 45px;
		// line-height: 45px;
		text-align: center;
		border-radius: 5px;
		margin-bottom: 5px;
		padding: 9px 0;
	}

	
	.name {
		
		flex: 1;
		text-align: left;
		font-size: 30rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: bold;
		color: #ED2933;
		line-height: 35rpx;
		margin-left: 26rpx;
		// border-right: 1px solid #382d0d;
		display: flex;
		align-items: center;
		.money{
			width: 22px;
			height: 22px;
			margin-left: 5px;
		}
	}
	
	
	
	.time {
		flex: 1;
		font-size: 24rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		color: #999999;
		line-height: 28rpx;
	}
	
	.item1 {
		margin-top: 15px;
		// border-bottom: 1px solid #382d0d;
		background: #FFE0E0;
		border-radius: 63rpx 63rpx 63rpx 63rpx;
	
		padding: 15rpx 27rpx;
		.name,.avata,.time{
			font-size: 25rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			color: #333333;
			line-height: 29rpx;
		}
	}
}
</style>
